package com.trassion.flutterhybirddemo

import android.app.Application
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.FlutterEngineCache
import io.flutter.embedding.engine.dart.DartExecutor
import io.flutter.embedding.engine.dart.DartExecutor.DartEntrypoint

class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        val flutterEngine = FlutterEngine(this)
        flutterEngine.navigationChannel.setInitialRoute("page_one")
        flutterEngine.dartExecutor.executeDartEntrypoint(DartEntrypoint.createDefault())

        val flutterEngine2 = FlutterEngine(this)
        flutterEngine2.navigationChannel.setInitialRoute("page_two")
        flutterEngine2.dartExecutor.executeDartEntrypoint(DartEntrypoint.createDefault())

        val flutterEngine3 = FlutterEngine(this)
        flutterEngine3.navigationChannel.setInitialRoute("page_three")
        flutterEngine3.dartExecutor.executeDartEntrypoint(DartEntrypoint.createDefault())
        FlutterEngineCache.getInstance().put("myFlutterEngine1", flutterEngine)
        FlutterEngineCache.getInstance().put("myFlutterEngine2", flutterEngine2)
        FlutterEngineCache.getInstance().put("myFlutterEngine3", flutterEngine3)
    }
}